//
// Created by Administrator on 2019/6/6 0006.
//

#ifndef FFMPEGDEMO_VIDEOCHANNEL_H
#define FFMPEGDEMO_VIDEOCHANNEL_H


#include "BaseChannel.h"
#include <pthread.h>
#include <android/native_window.h>
#include "AudioChannel.h"
#include "JavaCallback.h"
typedef void (*RenderFrame)(uint8_t *, int, int, int);
class VideoChannel : public BaseChannel {

public:
    VideoChannel(int id, JavaCallback *javaCallback, AVCodecContext *avCodecContext, AVRational time_base);
    virtual ~VideoChannel();
    virtual void play();
    virtual void stop();
    void decodePacket();
    void synchronizeFrame();
    void setRenderCallback(RenderFrame renderFrame);

    void setFps(int i);

private:

    pthread_t pid_video_play;
    pthread_t pid_synchronize;
    RenderFrame renderFrame;
    int fps;

public:
    AudioChannel *audioChannel;
};


#endif //FFMPEGDEMO_VIDEOCHANNEL_H
